Biblical Prophecy Intelligence Platform - Backend
Complete Cloudflare Worker backend with Hugging Face AI scoring for prophecy news analysis.
Features
🤖 AI-Powered Scoring
- Hugging Face Integration: Uses
facebook/bart-large-mnlifor zero-shot classification (FREE) - Multi-factor Analysis: Combines AI, keyword matching, and target individual detection
- Smart Threshold: Only saves articles with score ≥ 5.0
📡 RSS Feed Processing
- Hybrid Approach: RSS parsing with web scraping fallback
- Auto-scheduling: Runs every 15 minutes via Cron Triggers
- OPML Import: Bulk import 4000+ feeds at once
- Error Handling: Tracks failures and retries
🎯 Target Monitoring
- 15 Pre-loaded Individuals: Macron, Schwab, Netanyahu, etc.
- Tier System: Tier 1 (high priority) vs Tier 2 (medium)
- Mention Tracking: Automatically detects and weights mentions
📊 Sophisticated Scoring Algorithm
Overall Prophecy Score = (AI × 0.4) + (Keywords × 0.35) + (Targets × 0.25)
1. AI Score (40% weight)
- Classifies text against 12 prophecy-related categories
- Falls back to keyword-based analysis if API unavailable
2. Keyword Score (35% weight)
Weighted keywords:
- Critical (2.0): antichrist, mark of the beast, third temple
- High (1.5): tribulation, rapture, armageddon, Ezekiel 38
- Medium (1.0): prophecy, Israel, Jerusalem, digital currency
- Low (0.5): biblical, Christian, church, faith
3. Target Score (25% weight)
- Tier 1 individuals: 3.0 points per mention
- Tier 2 individuals: 2.0 points per mention
- Additional keyword matches: 0.3 points
📁 File Upload Support
- Documents: PDF, DOC, DOCX, TXT
- YouTube: URL processing (transcript extraction ready)
- Manual Entry: Direct article submission
API Endpoints
Health & Stats
GET /api/health → Health check
GET /api/stats → System statistics
Feed Management
GET /api/feeds → List all feeds
POST /api/feeds → Add new feed
PUT /api/feeds/:id → Update feed
DELETE /api/feeds/:id → Delete feed
POST /api/feeds/opml → Import OPML file
Articles
GET /api/articles/recent?limit=50&minScore=5.0 → Recent articles
POST /api/articles/score → Score single article
Ingestion
POST /api/ingest → Trigger RSS scan
POST /api/ingest/single → Submit single article
Targets
GET /api/targets → List all monitored individuals
POST /api/targets → Add new target
Uploads
POST /api/upload/document → Upload PDF/DOC/TXT
POST /api/upload/youtube → Submit YouTube URL
Dashboards
GET /api/dashboard/antichrist → Antichrist site data
GET /api/dashboard/prophecy → General prophecy site data
Setup Instructions
1. Install Wrangler CLI
npm install -g wrangler2. Login to Cloudflare
wrangler login3. Create D1 Database
wrangler d1 create prophecy-intelligenceCopy the database_id from the output and update wrangler.toml:
database_id = "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"4. Initialize Database Schema
wrangler d1 execute prophecy-intelligence --file=../YellowKidokc-enhanced-prophecy-dashboard-bigcards-frontend/schema.sqlThis will:
- Create all tables (analyzed_articles, rss_sources, target_individuals, etc.)
- Add indexes for performance
- Pre-load 15 monitored individuals (Tier 1 & 2)
- Pre-load 68 RSS feeds from your OPML
5. Get Hugging Face API Key (FREE)
- Go to https://huggingface.co/settings/tokens
- Create account (free)
- Generate new token with “Read” access
- Set as secret:
wrangler secret put HUGGINGFACE_API_KEYWhen prompted, paste your token.
6. Deploy to Cloudflare
wrangler deployYou’ll get a URL like: https://prophecy-intelligence-backend.your-subdomain.workers.dev
7. Test the API
curl https://your-worker-url.workers.dev/api/healthExpected response:
{
"ok": true,
"status": "healthy",
"timestamp": "2025-..."
}8. Trigger Initial Ingestion
curl -X POST https://your-worker-url.workers.dev/api/ingestThis will start processing all active RSS feeds.
Importing 4000 RSS Feeds via OPML
If you have an OPML file with 4000 feeds:
curl -X POST https://your-worker-url.workers.dev/api/feeds/opml \
-H "Content-Type: application/xml" \
--data-binary @your-feeds.opmlResponse:
{
"ok": true,
"imported": 4000
}Environment Variables
Set via wrangler secret:
HUGGINGFACE_API_KEY- Your HuggingFace API token (required for AI scoring)
Scheduled Ingestion
The worker automatically runs every 15 minutes to:
- Fetch all active RSS feeds
- Parse new articles
- Score each article
- Save articles with score ≥ 5.0
- Update feed statistics
- Track errors
View logs:
wrangler tailTesting Locally
wrangler devThis starts a local server at http://localhost:8787
Test scoring:
curl -X POST http://localhost:8787/api/articles/score \
-H "Content-Type: application/json" \
-d '{
"title": "Emmanuel Macron Proposes Seven-Year Peace Covenant for Middle East",
"content": "French President Emmanuel Macron announced today a comprehensive seven-year peace plan involving Israel, Palestine, and regional partners. The covenant includes provisions for joint governance of Jerusalem and reconstruction of a worship site on the Temple Mount."
}'Expected high score (8-10) due to:
- Target mention: Emmanuel Macron (Tier 1 → 3.0 points)
- Keywords: “seven-year” (2.0), “peace covenant” (2.0), “Temple Mount” (2.0), “Jerusalem” (1.0)
- AI classification: High prophecy relevance
Database Schema
Tables:
analyzed_articles- Scored articles (only ≥ 5.0)rss_sources- Feed configurationstarget_individuals- Monitored people (15 pre-loaded)article_target_mentions- Article-to-target relationshipskeyword_matches- Keyword tracking per articlesystem_alerts- High-priority notificationsanalysis_sessions- Ingestion run logsexport_logs- Data export history
Architecture
┌─────────────────────────────────────────────┐
│ Cloudflare Worker (Serverless) │
│ ├── RSS Feed Fetcher │
│ ├── Web Scraper (fallback) │
│ ├── Hugging Face AI Client │
│ ├── Scoring Engine (multi-factor) │
│ ├── D1 Database Interface │
│ └── CORS-enabled REST API │
└─────────────────────────────────────────────┘
↓ ↓
┌─────────────────┐ ┌──────────────────┐
│ Cloudflare D1 │ │ Hugging Face │
│ (SQLite) │ │ Inference API │
│ - Articles │ │ (FREE tier) │
│ - Feeds │ └──────────────────┘
│ - Targets │
└─────────────────┘
Cost
FREE (within Cloudflare free tier limits):
- 100,000 Worker requests/day
- 5 million D1 reads/day
- 100,000 D1 writes/day
- Hugging Face Inference API free tier
For 4000 feeds @ 15-min intervals:
- 4000 feeds × 4 checks/hour × 24 hours = 384,000 requests/day
- You’ll need Cloudflare Workers Paid plan ($5/month) for this volume
- Or reduce check frequency to hourly (96,000 requests/day → FREE)
Troubleshooting
”Database not found"
wrangler d1 list
wrangler d1 execute YOUR_DB_NAME --file=schema.sql"Hugging Face API returns 503”
Model is loading (cold start). Retry in 30 seconds or use fallback scoring (automatic).
”No articles being saved”
Check scores are ≥ 5.0:
curl -X POST https://your-worker.workers.dev/api/articles/score \
-d '{"title":"Test","content":"antichrist temple mount israel prophecy"}'“CORS errors”
CORS headers are included in all responses. Check browser console for actual error.
Next Steps
- Deploy Frontend: Use admin.html for feed management
- Create Two Sites:
- Antichrist site:
/api/dashboard/antichrist - Prophecy site:
/api/dashboard/prophecy
- Antichrist site:
- Set up Monitoring: Use Cloudflare Analytics dashboard
- Optimize Scores: Adjust weights in
scoreArticle()function - Add More Sources: Import your 4000-feed OPML
Support
Issues? Check:
- Cloudflare dashboard for errors
wrangler tailfor real-time logs- D1 console for database queries
License
MIT
Canonical Hub: CANONICAL_INDEX